import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SimulationVO, SimulationForm, SimulationQuery } from '@/api/bykt/simulation/types';

/**
 * 查询习题列表
 * @param query
 * @returns {*}
 */

export const listExercise = (query) => {
  return request({
    url: '/bykt/exercise/list',
    method: 'get',
    params: {...query}
  });
};

/**
 * 查询习题详细
 * @param id
 */
export const getExerciseInfo = (id: string | number) => {
  return request({
    url: '/bykt/exercise/' + id,
    method: 'get'
  });
};

/**
 * 新增习题
 * @param data
 */
export const addExercise = (data) => {
  return request({
    url: '/bykt/exercise',
    method: 'post',
    data: data
  });
};

/**
 * 修改习题
 * @param data
 */
export const updateExercise = (data) => {
  return request({
    url: '/bykt/exercise',
    method: 'put',
    data: data
  });
};

/**
 * 删除习题
 * @param id
 */
export const delExercise = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bykt/exercise/' + id,
    method: 'delete'
  });
};

// /bykt/exercise/export
export const exportExercise = (query) => {
  return request({
    url: '/bykt/exercise/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  });
}
